package com.motong.gongdan.vo.system.printTemplate.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
@Accessors(chain = true)
@ApiModel("根据模板打印数据")
public class ExportDataByModelVo {

    @ApiModelProperty("模板id")
    private Integer id;

    @ApiModelProperty("数据id")
    private Integer workId;

    @ApiModelProperty("数据ids(多个以,号隔开)")
    private String workIds;


    @ApiModelProperty("装配工单ids(多个以,号隔开)")
    private String assemblyIds;


    @ApiModelProperty(value = "assemblyIdList", hidden = true)
    private List<String> assemblyIdList = new ArrayList<>();

    /*逗号分隔格式化为数组*/
    public void setAssemblyIds(String assemblyIds) {
        if (StringUtils.hasLength(assemblyIds)) {
            assemblyIdList.addAll(Arrays.asList(assemblyIds.split(",")));
        }
        this.assemblyIds = assemblyIds;
    }

}
